package com.cc.model.convert

import com.cc.model.Repository
import com.cc.model.dto.RepositoryDto
import org.mapstruct.*

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING)
abstract class RepositoryConvert {

    abstract fun toEntity(repositoryDto: RepositoryDto): Repository

    abstract fun toDto(repository: Repository): RepositoryDto

    @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
    abstract fun partialUpdate(repositoryDto: RepositoryDto, @MappingTarget repository: Repository): Repository
}